<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Custom Loader
 *
 */

/*
 * $Id: OA_Loader.php 60 2011-08-14 09:34:44Z leikou@163.com $
 */


class OA_Loader extends CI_Loader
{
	
	function smarty($tpl, array $vars = array(), $return = FALSE)
	{
		$ci =& get_instance();
		$smarty =& load_class('OA_Smarty', 'libraries', '');
		
		// prevent reload vars
		$smarty->clearAllAssign();
		$smarty->assign($vars);
		
		// auto append '.tpl' suffix
		if(substr($tpl, -4) !== '.tpl')
		{
			$tpl .= '.tpl';
		}

		if($return)
		{
			return $smarty->fetch($tpl);
		}
		
		$ci->output->append_output($smarty->fetch($tpl));
	}
	
}

/* End of file: OA_Loader.php */
/* Location: ./application/core/OA_Loader.php */
